<script setup>
import { ref, inject, watch } from "vue";
defineOptions({
  name: "tabPanel",
});
const props = defineProps(["title"]);
const registerTitle = inject("addParTitle");
registerTitle(props.title);
const panelshow = inject("panelshow");
const pshow = ref(false);
pshow.value = panelshow.value === props.title;

watch(
  () => panelshow.value,
  (newVal) => {
    pshow.value = newVal === props.title;
  }
);
</script>

<template>
  <div class="tabpanel" v-show="pshow">
    <slot></slot>
  </div>
</template>

<style scoped></style>
